package cn.edu.tyu.finance.thingstype.servlet;
import java.io.IOException;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
//import cn.edu.tyu.finance.thingstype.domain.Users;
//import cn.edu.tyu.finance.thingstype.service.UserServiceImpl;

/**
 * Servlet implementation class UserServlet
 */
@WebServlet("/user")
public class UserServlet extends HttpServlet {
//	private static final long serialVersionUID = 1L;
//       
//	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//		String method = request.getParameter("method");
//		if("add".equals(method)) {
//			addUser(request,response);
//		}
//		
//	}
//	private void addUser(HttpServletRequest request, HttpServletResponse response) {
//		//接收页面发送过来的参数
//		String userid = request.getParameter("userid");
//		String username = request.getParameter("username");
//		String userpsw = request.getParameter("userpsw");
//		Users users = new Users();
//		users.setUserid(userid);
//		users.setUsername(username);
//		users.setUserpsw(userpsw);
//		UserServiceImpl userServiceImpl = new UserServiceImpl();
//		int res=0;
//		try {
//			res = userServiceImpl.addUser(users);
//			if(res>0) {
//				//进入查询页面
//				response.sendRedirect(request.getContextPath()+"/user?method=query");
//			}else {
//				//还是在添加页面
//				response.sendRedirect(request.getContextPath()+"/addUser.jsp");
//			}
//		} catch (SQLException e) {
//			e.printStackTrace();
//		} catch (IOException e) {
//			e.printStackTrace();
//		}
//		
//		
//	}
//	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//		doGet(request, response);
//	}

}